#import <Cocoa/Cocoa.h>
#import "ALTimelineElement.h"


@class ALTimelineView;

@interface ALTimelineCanvas : NSView <NSAnimationDelegate> {
}

@property (nonatomic, assign) ALTimelineView *timeline;


#pragma mark -
#pragma mark Layout
@property (nonatomic, assign) BOOL needsLayout;

-(void)layout;
-(NSSize)minimumSize;
-(BOOL)isLayoutRequiredForSize:(NSSize)canvasSize;
-(BOOL)isElementVisible:(ALTimelineElement *)element;


#pragma mark -
#pragma mark Geometry
@property (nonatomic, assign) CGFloat endPadding;
@property (nonatomic, assign) CGFloat topPadding;
@property (nonatomic, assign) CGFloat bottomPadding;

-(ALTimelineElement *)elementAtPoint:(NSPoint)aPoint;  // Point is in receiver's coordinates
-(NSArray *)elementsInRect:(NSRect)timelineFrame;      // Rect is in receiver's coordinates
-(NSRect)useableRectForBounds:(NSRect)bounds; // The receiver's bounds with any padding applied


#pragma mark -
#pragma mark Date/position conversions
-(CGFloat)positionOfDate:(NSDate *)aDate;
-(NSDate *)dateAtPosition:(CGFloat)xPosition;

@end
